<template>
	<view class="mainpadding2">
		<view class="mainpadding_top ffffff radius" v-for="item in list.data" :key="item.id" @click="jumpdetail('/pages/qingzixun/gonggaoxq?id=',item.id)">
			<view class="titletext xiaohei bold">{{item.name}}</view>
			<view class="main_size xiaohei margin_top">{{httpRequest.timereturn(item.createtime*1000)}}</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				httpRequest,
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			init(isPage, page) {
				httpRequest.request("/api/index/noticeIndex", 'GET', {
					page: page || 1,
					limit: this.limit,
					type:1
				}, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = this.list;
						if (isPage == true) {
							this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							this.list.data = resList.data;
						}
					}
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style>

</style>
